]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Fix invalid call to st_widget_get_theme_node() in WindowOverlay
authorFlorian Müllner <fmuellner@src.gnome.org>
Thu, 18 Feb 2010 04:15:28 +0000 (05:15 +0100)
committerFlorian Müllner <fmuellner@src.gnome.org>
Mon, 22 Feb 2010 17:33:58 +0000 (18:33 +0100)
WindowOverlay has two actors, both with custom style properties, which
share a common _onStyleChanged() handler. This is not a problem when
entering the overview, because the actors' parent (the workspaces group)
is hidden while the actors are added. However, when windows are added to
the workspace while in the overview (e.g. when opening a new window or
dragging a window from one workspace to another), adding the first actor
to the workspaces group triggers a style-changed signal - the handler
then calls st_widget_get_theme_node() on both actors, which triggers a
warning as the second actor has not been parented yet.

https://bugzilla.gnome.org/show_bug.cgi?id=610279

js/ui/workspace.js

index 365d9421696f97dbeb820fa19de43283d9d9d351..a9f2aeca1c599c67a30fc3bc2b265b9daea5dd8b 100644 (file)
@@ -361,8 +361,6 @@ WindowOverlay.prototype = {
 
         let title = new St.Label({ style_class: "window-caption",
                                    text: metaWindow.title });
-        title.connect('style-changed',
-                      Lang.bind(this, this._onStyleChanged));
         title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
         title._spacing = 0;
 
@@ -372,8 +370,6 @@ WindowOverlay.prototype = {
             }));
 
         let button = new St.Button({ style_class: "window-close" });
-        button.connect('style-changed',
-                       Lang.bind(this, this._onStyleChanged));
         button._overlap = 0;
 
         this._idleToggleCloseId = 0;
@@ -396,6 +392,14 @@ WindowOverlay.prototype = {
 
         parentActor.add_actor(this.title);
         parentActor.add_actor(this.closeButton);
+        title.connect('style-changed',
+                      Lang.bind(this, this._onStyleChanged));
+        button.connect('style-changed',
+                       Lang.bind(this, this._onStyleChanged));
+        // force a style change if we are already on a stage - otherwise
+        // the signal will be emitted normally when we are added
+        if (parentActor.get_stage())
+            this._onStyleChanged();
     },
 
     hide: function() {